package cn.xej.demo.util;

import cn.xej.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @Author alicat.xu
 * @Date 2021/8/31 5:46 下午
 */

public class StringCheckUtil {

    private UserService userService;
    public  StringCheckUtil(UserService userService){
        this.userService= userService;
    }

    /**
     * 校验是否包含特殊字符
     * @param str
     * @return
     */
    public static boolean isContainSpecialChar(String str) {
        String regEx = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~！@#￥%……&*（）——+|{}【】‘；：”“’。，、？]";
        Pattern p = Pattern.compile(regEx);
        Matcher matcher = p.matcher(str);
        boolean b = matcher.find();
        return b;
    }

}
